home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 21 / CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso / CUCD / Programming / gtdrag / esource / source / gtdrag.e < prev   
Encoding:
Text File  |  1996-12-17  |  3.2 KB  |  101 lines

  1. OPT MODULE
  2. OPT EXPORT
  3. /*
  4. **  $VER: gtdrag.e 2.1 (17.12.96)
  5. **  Includes Release 2.7
  6. **
  7. **  Drag&Drop with GadTools
  8. **
  9. **  (C) Copyright 1996 Axel Dörfler
  10. **      All rights Reserved
  11. **
  12. ** Converted to E by Daniel Rost
  13. */
  14.  
  15. MODULE 'exec/nodes','utility/hooks',
  16.        'intuition/intuition','libraries/gadtools',
  17.        'utility/tagitem','exec/tasks','exec/lists'
  18.  
  19. /* The ImageNode structure is used to have both text and images in a listview.
  20.  * A render hook for this type is provided. It is not a must!
  21.  */
  22.  
  23. OBJECT imagenode
  24.   succ:PTR TO imagenode
  25.   pred:PTR TO imagenode
  26.   type:CHAR
  27.   pri:CHAR
  28.   name:PTR TO CHAR
  29.   image:PTR TO image
  30. ENDOBJECT
  31.  
  32. /* The DragGadget structure manages the gadgets which support dragging.
  33.  * Remember that these fields are read-only!
  34.  */
  35.  
  36. CONST DGF_IMAGES=1,       /* Images only, if possible */
  37.       DGF_NODRAG=2,       /* can't be the source of a drag */
  38.       DGF_SAME=4,         /* icon can be dragged over the same gadget */
  39.       DGF_NOPOS=8         /* no positioning, listview only */
  40.  
  41. OBJECT draggadget
  42.   node:mln
  43.   gadget:PTR TO gadget
  44.   window:PTR TO window
  45.   task:PTR TO tc          /* pointer to the owner task */
  46.   list:PTR TO lh
  47.   render:PTR TO hook
  48.   type:LONG
  49.   mask:LONG
  50.   acceptmask:LONG
  51.   itemheight:INT
  52.   width:INT
  53.   height:INT
  54.   flags:INT
  55. ENDOBJECT
  56.  
  57. /* You receive the DragMsg structure if someone has dragged an item.
  58.  * And again, all fields are read-only!
  59.  */
  60.  
  61. CONST DMT_GADGET=1,     /* target is a window */
  62.       DMT_WINDOW=2,     /* target is a gadget */
  63.       DMT_UNKNOWN=4     /* target doesn't support drag&drop */
  64.  
  65. OBJECT dragmsg
  66.   node:mln
  67.   type:LONG
  68.   object:PTR TO imagenode       /* dragged object */
  69.   source:PTR TO draggadget
  70.   sourceapp:PTR TO CHAR         /* owner Name or NULL for your own */
  71.   target:LONG                   /* pointer to a DragGadget or Window */
  72.   sourceentry:LONG              /* the list position of the entry */
  73.   targetentry:LONG              /* dto. - may be higher than the number of entries */
  74.   x:LONG                        /* exact co-ordinates */
  75.   y:LONG
  76. ENDOBJECT
  77.  
  78. /* The flags for the IDCMP-MsgPort of your Window */
  79.  
  80. CONST DRAGIDCMP=LISTVIEWIDCMP OR IDCMP_MOUSEBUTTONS
  81.  
  82. /* Tags to pass to GTD_AddGadget() */
  83.  
  84. CONST GTDA_TAGBASE      =TAG_USER + $90000
  85. CONST GTDA_ITEMHEIGHT   =GTDA_TAGBASE + 1,    /* height of a listview entry */
  86.       GTDA_RENDERHOOK   =GTDA_TAGBASE + 2,    /* render hook for listview */
  87.       GTDA_IMAGES       =GTDA_TAGBASE + 3,    /* drags only images (listview MUST contain ImageNodes) */
  88.       GTDA_WIDTH        =GTDA_TAGBASE + 4,    /* width of icon (only for GTDA_RenderHook & GTDA_Images) */
  89.       GTDA_HEIGHT       =GTDA_TAGBASE + 5,    /* height of a icon ("") */
  90.       GTDA_NODRAG       =GTDA_TAGBASE + 6,    /* do not drag from this gadget */
  91.       GTDA_OBJECT       =GTDA_TAGBASE + 7,    /* drag node from a non-listview */
  92.       GTDA_SAME         =GTDA_TAGBASE + 8,    /* set DGF_SAME */
  93.       GTDA_MASK         =GTDA_TAGBASE + 9,    /* mask value */
  94.       GTDA_ACCEPTMASK   =GTDA_TAGBASE + 10,   /* accept mask value */
  95.       GTDA_NOPOSITION   =GTDA_TAGBASE + 11    /* set DGF_NOPOS */
  96.  
  97. /* Tags to pass to GTD_AddApp() */
  98.  
  99. CONST GTDA_INTERNALONLY=GTDA_TAGBASE + 42   /* drags only internally */
  100.  
  101.